#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : gtmsAutoTestProject 
@File    : shop_application_event_insert_interface.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/5/5 17:34 
@Describe: 推送门店应用事件接口类
"""
from fastapi import APIRouter
from FastApi.dto.baseResponseDto import BaseResponseDtoModel
from FastApi.server.middle.setup.pos.shop_application_event_insert_server import pos_server_reboot
from FastApi.dto.middle.setupDto.pos.shop_application_event_insert_dto import ShopAppEventInsertRequestDtoModel
from Comm.logUtils.logControl import LogHandler

logger = LogHandler().get_logger()
shopAppEventInsert_router = APIRouter()
response_model = BaseResponseDtoModel()


@shopAppEventInsert_router.post("/server/reboot", name="重启门店助手服务")
async def posServeReboot(payload: ShopAppEventInsertRequestDtoModel):
    logger.info('请求参数:[{}]'.format(payload))
    pos_server_reboot(payload.environment, payload.brandCode)
    response_model.return_dict['message'] = '助手重启成功'
    response_model.return_dict['data'] = 'None'
    logger.info('接口响应:[{}]'.format(response_model.return_dict))
    return response_model.return_dict
